//! 右下角必然是合数.
//! 逆时针每个减2n.
//! 
//! 如果左上角4n^2+1 是质数 p 的倍数, 则4n^2+1=0 \pmod p,

mod solu_euler;
mod solu_force;
mod tools;

pub fn min_edge_prime_num(number: u32) -> String {
    let ans = solu_force::min_edge_prime_num(number);
    // let ans = solu_euler::min_edge_prime_num(number);
    format!("{},{}", ans.0, ans.1)
}

/// 获取螺旋矩阵边长为length的正方形的四角上的数字.
///
/// - 右下角↘: length^2
/// - 逆时针每次减去 length - 1
fn get_corner_value(length: u128) -> [u128; 4] {
    let bottom_right = length * length;
    let dec = length - 1;
    [
        bottom_right - 3 * dec,
        bottom_right - 2 * dec,
        bottom_right - dec,
        bottom_right,
    ]
}

// mod tests {
//     use super::*;
//     use std::time::{Duration, Instant};

//     #[test]
//     fn test_prime_percent() {
//         // let (input, expected) = (60, "5,5");
//         let (input, expected) = (7, "1213001,169820");
//         // let (input, expected) = (8, "238733,38197");
//         let start = Instant::now();
//         let result = solu_force::min_edge_prime_num(input);
//         let duration1 = start.elapsed();
//         assert_eq!(format!("{},{}", result.0, result.1), expected);
//         println!("used time 1: {:?}", duration1);

//         // let start = Instant::now();
//         // let result = solu_euler::min_edge_prime_num(input);
//         // let duration2 = start.elapsed();
//         // assert_eq!(format!("{},{}", result.0, result.1), expected);
//         // println!("used time 2: {:?}", duration2);
//     }
// }
